home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8082 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: due.unit.no!usenet
  2. From: Vidar Moe <vidarm@ibt.unit.no>
  3. Newsgroups: comp.lang.c++
  4. Subject: Solaris -> Windows & byte swapping
  5. Date: 14 Feb 1996 12:21:33 GMT
  6. Organization: SINTEF Unimed
  7. Message-ID: <4fsk4d$lab@due.unit.no>
  8. NNTP-Posting-Host: unipc50.unimed.sintef.no
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  13.  
  14. I have transferred some binary datafiles from Solaris to my PC 
  15. using ftp with the binary file transfer.
  16.  
  17. My problem is that when I try to parse the datafiles under 
  18. Windows (VC40) using the same C code as on Solaris, it simply 
  19. doesn't work.
  20.  
  21. I suspect that the parsing failes due to some byteswapping, 
  22. difference in HiByte/LoByte or something like that. I read the 
  23. file using fread to get the binary (image) data into a buffer
  24.  
  25.     fread(buffer, sizeof(unsigned char), dim, mImageFile);
  26.  
  27. and then I process the bytes in the buffer further (my task is 
  28. to convert a 12 bit image into an 8 bit image, and my problem 
  29. is basically that the 12 bits belonging to each pixel is 
  30. organized differently in the buffer under Windows than under 
  31. Solaris!)
  32.  
  33. Can somebody help me with this, or give some hints about what 
  34. I might be doing wrong?
  35.  
  36.  
  37.  
  38. Vidar Moe
  39. Organization: SINTEF Unimed
  40.  
  41.